package com.xtwy.admin.web.service.impl;

import com.github.pagehelper.PageHelper;
import com.xtwy.admin.web.mapper.MemberMapper;
import com.xtwy.admin.web.model.pojo.Member;
import com.xtwy.admin.web.service.MemberService;
import com.xtwy.admin.web.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * 类的描述：
 *
 * @作者: 侯建军
 * @邮箱: 474177818@qq.com
 * @博客: https://blog.csdn.net/marquis888
 * @创建日期: 2018年11月18日  22:28
 * @版本: v1.0
 * @jdk版本使用: JDK1.8
 */
@Service
public class MemberServiceImpl implements MemberService {
    @Autowired
    private MemberMapper memberMapper;

    public List<Member> getPageList(Member member) {
//        PageHelper.offsetPage(member.getOffset(), member.getLimit());
//        PageHelper.orderBy(CamelCaseUtil.toUnderlineName(member.getSort())+" "+member.getOrder());
        return memberMapper.selectAll();
    }

    public Integer getCount(Example example){
        return memberMapper.selectCountByExample(example);
    }

    public Member getMember(Member member){
        return memberMapper.selectOne(member);
    }

    public Member findByUsername(String username) {
        return memberMapper.selectByUsername(username);
    }

    public void insert(Member member){
        memberMapper.insert(member);
    }
}
